UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iZw4pAnsZz3yRBp9+yrWpW/QYtUPAPvN+g9yWrdlOBw='
WHERE
key_id = 'd1bd3c675b534e97d3c5dff6dd72344f41dce24a1ecfa668119e80abcb8b340c'
AND (
token = 'iZw4pAnsZz3yRBp9+yrWpW/QYtUPAPvN+g9yWrdlOBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)