UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VECVUqpg66ecpaS+/1/zLJ9r826Da8ObLGSBkgid3Bk='
WHERE
key_id = 'a4c3c954fff4fc96541a4c8c9c584090cd9918394d2ac8e6319bee78c07db994'
AND (
token = 'VECVUqpg66ecpaS+/1/zLJ9r826Da8ObLGSBkgid3Bk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)