UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EW0iysFkh/5AqRvkt2MHJ/tStvWvxUKuh9d4wtVvkTg='
WHERE
key_id = '41817a83831835af70cafbfb90811db0f492a05b4c9ec3da443c6ab259994d74'
AND (
token = 'EW0iysFkh/5AqRvkt2MHJ/tStvWvxUKuh9d4wtVvkTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)