UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KFDgKyUvUprRDVSHu8ug33Z+3MxOAp/aHlMV4C1G8CU='
WHERE
key_id = '37e2a8213e1c6d59cc22da61b799ce28db470df613a7c301eee977b57b6638bb'
AND (
token = 'KFDgKyUvUprRDVSHu8ug33Z+3MxOAp/aHlMV4C1G8CU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)