UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BbH9Ev3qEKpTbFqr2ndx7U7kE4K0k7lCv2sRpGkDBQI='
WHERE
key_id = '8a8e51b26343660b55cf2846e43a560cceb344be2184fd5b5411b98054c52441'
AND (
token = 'BbH9Ev3qEKpTbFqr2ndx7U7kE4K0k7lCv2sRpGkDBQI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)