UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gr1euGaQA2ADZnezgT52BmxndHZaUS4jfdyCGYRFtHc='
WHERE
key_id = 'c20daa48b1c6e279083c36ae0bc4c142692139be2a8ec647e540bdce38b31fad'
AND (
token = 'gr1euGaQA2ADZnezgT52BmxndHZaUS4jfdyCGYRFtHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)