UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qNGXsglz7dC4Ah7fI2vCwOOazT7KhJs2WMEnX7jad+0='
WHERE
key_id = '9aa38fccadb6d7dc35d829c99d2c38425559c6ca1482061a80118369dd79eea0'
AND (
token = 'qNGXsglz7dC4Ah7fI2vCwOOazT7KhJs2WMEnX7jad+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)