UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rRZ1uQh7BR0I+ydBrcUnlmvCgdBNKrP6503aO/BMnJk='
WHERE
key_id = '31a1474ac6a08253f1cb25f13be23d1ca090f1a4e00f775e788031b7fc12801f'
AND (
token = 'rRZ1uQh7BR0I+ydBrcUnlmvCgdBNKrP6503aO/BMnJk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)