UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'peezQj7uYC/A3MQzWCVldUa74yCoqLfxf+cFNHxz5Os=' 
WHERE 
  key_id = '221301d3a461b8788c49cdc781ccc5eb1dea98b3257c1e1de137b2390bc3fc97' 
  AND (
    token = 'peezQj7uYC/A3MQzWCVldUa74yCoqLfxf+cFNHxz5Os=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025