UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iCYPMhjB7hWnx91XfuDs+6PrDq7fz9cOou89rRrp0jI='
WHERE
key_id = '815782416237f1c042e5ed99dda509a91e01f5bc1de5f89cb0fd5ce1f954a99f'
AND (
token = 'iCYPMhjB7hWnx91XfuDs+6PrDq7fz9cOou89rRrp0jI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)