UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q65FwZuaf+rN/OJ3R2UoasIS+f6oEuTEOkybp/ufL7c=' 
WHERE 
  key_id = '2669594746ccf630084a7524538ad38f414076cfedcc4a584429714b384124e2' 
  AND (
    token = 'q65FwZuaf+rN/OJ3R2UoasIS+f6oEuTEOkybp/ufL7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048