UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mGe93mywlsMN/ptrVcwU187hrjNfTkZ1pIBx6VU7owI=' 
WHERE 
  key_id = '968201447f9f976410c143ce1e3f36d8ccbb7503db76f9620830017162a10d16' 
  AND (
    token = 'mGe93mywlsMN/ptrVcwU187hrjNfTkZ1pIBx6VU7owI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016