UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bHps0dYvvM99gTrb57MyNG7ZnzALepgbZuE4eZrFHcs='
WHERE
key_id = '9e61928633a6f69e054c3d472b4b7359c6319b2aa2e1a2acb4d330a9d0244091'
AND (
token = 'bHps0dYvvM99gTrb57MyNG7ZnzALepgbZuE4eZrFHcs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)