UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GY6Rb4JyHSsPoRw4imB8nb+BOMc4BJAqTMmSsj4uKY8=' 
WHERE 
  key_id = 'c9bf8ad461a9210290f4d34d398a8b035761e48957cc3a8e2acc1b3cad75b514' 
  AND (
    token = 'GY6Rb4JyHSsPoRw4imB8nb+BOMc4BJAqTMmSsj4uKY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023