UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LdMEStz4dv9z0PbD650oZh3QM3IzDIDoMn6fjWKBN3w='
WHERE
key_id = 'b649240caaa1e0e6dfb176ee73c49a4be33e2e70412cfccc41108ac77c8b97b6'
AND (
token = 'LdMEStz4dv9z0PbD650oZh3QM3IzDIDoMn6fjWKBN3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)