UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Wgi+9KUr0Fi3+bQoQfAigsbgn79AOHOIKnFEnvLvdFM='
WHERE
key_id = '3a9c67429b455fc27a950a161c0fe55cd333b2f025fc009215d4b0e98dbb64f0'
AND (
token = 'Wgi+9KUr0Fi3+bQoQfAigsbgn79AOHOIKnFEnvLvdFM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)