UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qldEkMOyYI2HgZ0ZeNzoJV0SS4EUPwB7cQFUmlY17yY=' 
WHERE 
  key_id = '43d385d4d43fea7e80c8c02c5f888ee72772e04f0940e52c307ae48f7e27fb69' 
  AND (
    token = 'qldEkMOyYI2HgZ0ZeNzoJV0SS4EUPwB7cQFUmlY17yY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023