UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e+FgJWc4WeB5nNEONnIZmESgobYZfnKcA9MD+epxB9k='
WHERE
key_id = 'af58f97b7ae5493cec88b99e12656034779d1920f02bda270b5fbbb198deee37'
AND (
token = 'e+FgJWc4WeB5nNEONnIZmESgobYZfnKcA9MD+epxB9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)