UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EElF6Y7S6btZxFIDrUh+757D81MwKZJrNtsvZJKnZIM=' 
WHERE 
  key_id = '2f5e92983bc3652e21786a5105bb0a994f85ab0743932eb7c5cc1990c8871088' 
  AND (
    token = 'EElF6Y7S6btZxFIDrUh+757D81MwKZJrNtsvZJKnZIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022