UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4lR1VtnZ3K01dv9e4Omzoc8uRFYpyg8uhfRS1LSj9wM='
WHERE
key_id = 'd9c9b7b90549b9bfb328c0e65fff516c581aa57719581243c77b2d3c1dd15bb3'
AND (
token = '4lR1VtnZ3K01dv9e4Omzoc8uRFYpyg8uhfRS1LSj9wM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)