UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qss0I6B/Z29Ozr9rFuFElnbehG2SUFfBS8tNFqihIVA='
WHERE
key_id = '8f2038445348a9c97110b9a98ca01e94b67a364b5cce4efd4dd6b47c4cad9dc5'
AND (
token = 'qss0I6B/Z29Ozr9rFuFElnbehG2SUFfBS8tNFqihIVA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)