UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IAyQLKwCJXFRPKMY/4tO49hQlsJVFqv7KEdMhHUzcTg='
WHERE
key_id = '76504a3bdd2d27978a06376b97046c4eaf2470be8ef9f820d19b90b54674075e'
AND (
token = 'IAyQLKwCJXFRPKMY/4tO49hQlsJVFqv7KEdMhHUzcTg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)