UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YQCWLEooNEaMAdRj7y+1f39sLrqLqBfrufjumKISXGc=' 
WHERE 
  key_id = '686d9a6979a3b4eb695537e40986993b753caa91965c5497754a15b026db6a5f' 
  AND (
    token = 'YQCWLEooNEaMAdRj7y+1f39sLrqLqBfrufjumKISXGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042