UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'axy+ZcGIToCg0J50ud84B6ODfxdhfoFWM6hssPMq2J8=' 
WHERE 
  key_id = '6f23ec41f3f445012135663896b4b4f5a34d133c91b9200c1a5afb5246c70238' 
  AND (
    token = 'axy+ZcGIToCg0J50ud84B6ODfxdhfoFWM6hssPMq2J8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00140