UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bkeLubWf0TPwUFMd7EXNiqzsBlV2yKOmQbMhMe8nhI8='
WHERE
key_id = '3ba36d39308c28d83cb4ad1b614efece7629e94827559f1f2789a38aef9bf900'
AND (
token = 'bkeLubWf0TPwUFMd7EXNiqzsBlV2yKOmQbMhMe8nhI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)