UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0Wtpk2NCjYditfRhr/kWqk5ubzexIqWJzt5nVmOfL5g='
WHERE
key_id = 'a850b5df834007ddf4c2095c9c17e067cc5584ddf27ecc5b1290390e1ffb7fe8'
AND (
token = '0Wtpk2NCjYditfRhr/kWqk5ubzexIqWJzt5nVmOfL5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)