UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fpA06zEjbCSAyZ447hEIyWT3Spa2A2V8B5aSbND8dzA=' 
WHERE 
  key_id = '9a50715511959282fbc64433f109caf72785bc2966436543acc889b70b4d22bb' 
  AND (
    token = 'fpA06zEjbCSAyZ447hEIyWT3Spa2A2V8B5aSbND8dzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033