UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OU2Fnxoyg/8VGeCfyRtk08nHap+bkqAYCeBqJcPxXRc=' 
WHERE 
  key_id = 'b9f5556504aacff2e793db221a3c9fd5b384b6b4b1e607f2a09920706a0af5e8' 
  AND (
    token = 'OU2Fnxoyg/8VGeCfyRtk08nHap+bkqAYCeBqJcPxXRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025