UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TcKlBsmB6izW6PY1W80kzLbOdW+Ph+Po5KJiIZgQ0PM='
WHERE
key_id = 'f74714ddc6c13998a4ddc16b1b97e33680780077da1ad733edf9de18193423cb'
AND (
token = 'TcKlBsmB6izW6PY1W80kzLbOdW+Ph+Po5KJiIZgQ0PM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)