UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ihYrFDWznYg+aI3NHUgp2Kv8lsi4fRF9wYj59X6O+so='
WHERE
key_id = 'd5bc8d37efeaa74a2d732552e9d73472f22bf758282adce8e5c0cc0540cde0bb'
AND (
token = 'ihYrFDWznYg+aI3NHUgp2Kv8lsi4fRF9wYj59X6O+so='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)