UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ql4Ti1/Yrpz5M1j1qDd806DCPviflODhgx4iuEPGF3Q=' 
WHERE 
  key_id = 'b3862613edf5e764eac4686238809b2109cd373dd5a186f7551090b1a77dd36a' 
  AND (
    token = 'ql4Ti1/Yrpz5M1j1qDd806DCPviflODhgx4iuEPGF3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035