UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XsGY4RUM4ir2Fla8MbAWZ8osh8GS/zKYpN5Da9JWd5U='
WHERE
key_id = 'd399578fe1f0f686c43586231b300ae5458c598023e17da7bfe2b512b93ba2a2'
AND (
token = 'XsGY4RUM4ir2Fla8MbAWZ8osh8GS/zKYpN5Da9JWd5U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)