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