UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DlMgwoNCmBeA4hD8EW1HeQ901mL6iYVXbcvJsCghkH4=' 
WHERE 
  key_id = '09b371269bf311e2b05e7db46398ba87f3e7a5741d94df5aa9042dd7796935f7' 
  AND (
    token = 'DlMgwoNCmBeA4hD8EW1HeQ901mL6iYVXbcvJsCghkH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027