UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CldD0fP0C/B+jBdp2+vnRKYzPG4nQciZaJIieTlq1P8='
WHERE
key_id = '6dfd9d67d7f30b8df80b28baca5ce27ad12b3ea16655b3e04afa5218ff7175f2'
AND (
token = 'CldD0fP0C/B+jBdp2+vnRKYzPG4nQciZaJIieTlq1P8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)