UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'atJ1FPjDW0Q9vHhBq6yOtosxJLCns+QDxJAQkppkv24='
WHERE
key_id = '00762b593ef38e1b4657a3d46a1b3dac72236b792f07b61a2d07b7b137d57302'
AND (
token = 'atJ1FPjDW0Q9vHhBq6yOtosxJLCns+QDxJAQkppkv24='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)