UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Flp1zObhAjyyMPhXpCdT5BOBMm1gW0niWd7Jch1Ab/E='
WHERE
key_id = '8197df815163dc86eddfef8cd791c02f5d9ace6d9aa4cebe9ed6fd106c1b5977'
AND (
token = 'Flp1zObhAjyyMPhXpCdT5BOBMm1gW0niWd7Jch1Ab/E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)