UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oTtFqtxZ5BeziYKeZnoDWRH6g3duXPE5FwaEUoamop4='
WHERE
key_id = 'bc6f99d551f6ea73422a19f986346dca3bb64840712ae0b6cae4f4e27793bdce'
AND (
token = 'oTtFqtxZ5BeziYKeZnoDWRH6g3duXPE5FwaEUoamop4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)