UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P0ZVuCYwOEJ/IFmfHSEH6KZdROzj+OlBMSIRsuNSpPo=' 
WHERE 
  key_id = '77a99c9ef752e2a24e72fc5786b782c07ecca7faf76204a6042cec81493d1786' 
  AND (
    token = 'P0ZVuCYwOEJ/IFmfHSEH6KZdROzj+OlBMSIRsuNSpPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035