UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xPHlCzkD7NF1Ix30tSDtHjm013J/iJlM0cGfoE01R84='
WHERE
key_id = '713ac6914a2258c6b2e2f8145e8ecc7862b004a9359f38863b5f6a40f5bc6b49'
AND (
token = 'xPHlCzkD7NF1Ix30tSDtHjm013J/iJlM0cGfoE01R84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)