UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b4bE9WuyB2C9OI2an57/C5nw0PxGmdlg5VnBPvI/Dow=' 
WHERE 
  key_id = '5839496e9376ea980b0b0871dba372fc91fd6c8b48ab4498d49fd0f589af4cd8' 
  AND (
    token = 'b4bE9WuyB2C9OI2an57/C5nw0PxGmdlg5VnBPvI/Dow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042