UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P+SZxNmZNT8b/6yBInbk9A2G42MfIExkxywEUGiJlVs='
WHERE
key_id = 'c992343ba381711074d974dddbde92d0a3f84392c5ad65dea6332d6492a34dae'
AND (
token = 'P+SZxNmZNT8b/6yBInbk9A2G42MfIExkxywEUGiJlVs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)