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