UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't1ofA6S/W0sWuJXFkJrDZQfzxZ38cHOhiAGx6QCpQB8='
WHERE
key_id = '57bb7ed592bd0396122c1f454f7c3ad9c6ca161b3b7e0f79c06c039ad223708f'
AND (
token = 't1ofA6S/W0sWuJXFkJrDZQfzxZ38cHOhiAGx6QCpQB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)