UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JRUn01pBciOH9EYzkE7brcM6HNnGcyWPZi2hBFQyJHI=' 
WHERE 
  key_id = '096ef10f9ec6155b5c2955498479a768ea7f1fb1a122c73435ae9f0980551639' 
  AND (
    token = 'JRUn01pBciOH9EYzkE7brcM6HNnGcyWPZi2hBFQyJHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038