UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6ZukZKGIVA2wDVENWGKGND2+B6Ut3M1lhsj3gpMJkX8='
WHERE
key_id = 'f5bfdc5f24c0326cfabf6132278022a8a66552479c9a6f3fb3c8c6997bc71b1a'
AND (
token = '6ZukZKGIVA2wDVENWGKGND2+B6Ut3M1lhsj3gpMJkX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)