UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KKWA80waPZHpPSHpJh3tDid9qEORC3dZWb1n26GRov0='
WHERE
key_id = '2fb89a0c7573269b0af417786fb8f8e4ebd3ab16f3c82f4d271af814a6d7d249'
AND (
token = 'KKWA80waPZHpPSHpJh3tDid9qEORC3dZWb1n26GRov0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)