UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rOPfzEbXb1HtlH3ylMDWgy04xmBLGWvkPi2csM+02T4='
WHERE
key_id = 'f2c4ec3ff0eb978144fc19be6796c04e19495710557ca9e9eb823faf172a0f12'
AND (
token = 'rOPfzEbXb1HtlH3ylMDWgy04xmBLGWvkPi2csM+02T4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)