UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'blnASRasJ8GjTcrukBHtNhdb1keDVBtPvtqd1yOV6Iw=' 
WHERE 
  key_id = '5264785ab546c509ac2d4db4d7e2cf36782ff1533ba2847ac89955887c5babbb' 
  AND (
    token = 'blnASRasJ8GjTcrukBHtNhdb1keDVBtPvtqd1yOV6Iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048