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