UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PMdELR91z7qyGVF7FaYhQ9dzyhAspvwenHmBt/a5Aws=' 
WHERE 
  key_id = '777b6c691cd2ca31c04ab6d2ea221dc4bdcecb638ad6435fbea930578cd4b3a3' 
  AND (
    token = 'PMdELR91z7qyGVF7FaYhQ9dzyhAspvwenHmBt/a5Aws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046