UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sCKUSWeXPhmG4ExVVbBp3EN09nc9wCCPzcpAdgGfoBk=' 
WHERE 
  key_id = 'e99d34b50d495209e2b7467a4e8aac597dfbeb65cd0f46290858a3ecbba87b57' 
  AND (
    token = 'sCKUSWeXPhmG4ExVVbBp3EN09nc9wCCPzcpAdgGfoBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017