UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9jRNM6aEHkUkUrhT+7wPAQSU8wLst8bWexS7dTwjgYk='
WHERE
key_id = 'aee9c6d65c35a843ff954e379b8d2cd8a6cfc24ec926bbb9bf596b1fb2dd4127'
AND (
token = '9jRNM6aEHkUkUrhT+7wPAQSU8wLst8bWexS7dTwjgYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)